//
//  BasicNavViewController.m
//  TestAll
//
//  Created by zhaoguoying on 2017/11/20.
//  Copyright © 2017年 ZDHS. All rights reserved.
//

#import "BasicNavViewController.h"

@interface BasicNavViewController ()

@end

@implementation BasicNavViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    /** 状态栏白色
     1.在info.plist中添加View controller-based status bar appearance,值为NO
     2.在设置状态栏的地方添加如下代码
     */
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
    
    [UINavigationBar appearance].barTintColor = RGBCOLOR(54, 53, 59, 1); // 背景颜色 所有
//    self.navigationBar.barTintColor = RGBCOLOR(54, 53, 59); // 背景颜色 当前
    if (IS_IPHONE) {
        NSString *image;
        if (SCREEN.size.width==414) { image = @"TJ_navigationBar@3x"; //XR
        }else{ image = @"TJ_navigationBar";
        }
        [self.navigationBar setBackgroundImage:[UIImage imageNamed:image] forBarMetrics:UIBarMetricsDefault]; // 背景图
    }else{
        [self.navigationBar setBackgroundImage:[UIImage imageNamed:@"TJ_navigationBarPad"] forBarMetrics:UIBarMetricsDefault];
    }
    
    NSDictionary *dic1 = @{NSForegroundColorAttributeName:[UIColor whiteColor],
                          NSFontAttributeName:[UIFont systemFontOfSize:18]};
    self.navigationBar.titleTextAttributes = dic1;
    
    self.navigationBar.tintColor = [UIColor whiteColor]; // 不设置两侧item会变蓝色
//    self.navigationBar.translucent = YES; // 设置navigationBar的透明效果
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    if(self.viewControllers.count > 0)viewController.hidesBottomBarWhenPushed = YES;
    return [super pushViewController:viewController animated:animated];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
